#pragma once
#pragma warning(disable:4407)


class CBaseTimeObject;
typedef void (CBaseTimeObject::*PFN_TIMER)(void);

class CBaseTimeObject
{
public:
    CBaseTimeObject(void) {};
    ~CBaseTimeObject(void) {};
    virtual void OnTimerCallback( PFN_TIMER pfn ) = 0;
};

typedef struct _my_timer_ {
    PFN_TIMER         m_pfn;
    CBaseTimeObject*  m_pObj;
    int m_nCurTime;
    int m_nCallTimer;
    _my_timer_( CBaseTimeObject* pObj, PFN_TIMER pfn, int sec ) {
        m_pObj=pObj; m_pfn=pfn; m_nCallTimer=sec; m_nCurTime=0;
    }
}MYTIMER, *LPMYTIMER;
typedef std::vector< MYTIMER > VEC_TIMER;


class CBaseTimer
{
private:
    static int m_nTimeStep;
    static VEC_TIMER m_vecTimer;

public:
    CBaseTimer(void);
    ~CBaseTimer(void);

    static void CheckOnTimer();
    static void SetTimeStep(int nStep){ m_nTimeStep=nStep; }
    static void DelTimer( CBaseTimeObject* pObj, PFN_TIMER pfn );
    static void AddTimer( CBaseTimeObject* pObj, PFN_TIMER pfn, int nSec );
};
